// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.vehicles;

import java.util.ArrayList;
import java.util.List;
import org.joml.Vector3f;
import org.lwjgl.util.vector.Vector2f;
import zombie.characters.IsoPlayer;
import zombie.core.physics.CarController;
import zombie.core.physics.WorldSimulation;
import zombie.debug.LineDrawer;

public class CircleLineIntersect {
    public static CircleLineIntersect.Collideresult checkforcecirclescollidetime(
        List<CircleLineIntersect.ForceCircle> list,
        ArrayList<CircleLineIntersect.StaticLine> arrayList0,
        double[] double2,
        boolean[] boolean1,
        boolean boolean0
    ) {
        CircleLineIntersect.PointVector[] pointVector = new CircleLineIntersect.PointVector[list.size()];
        double[] double0 = new double[list.size()];
        CircleLineIntersect.Collideclassindex[] collideclassindex = new CircleLineIntersect.Collideclassindex[list.size()];
        double[] double1 = new double[list.size()];

        for (int int0 = list.size() - 1; int0 >= 0; int0--) {
            double0[int0] = -1.0;
            collideclassindex[int0] = new CircleLineIntersect.Collideclassindex();
            pointVector[int0] = (CircleLineIntersect.PointVector)list.get(int0);
            double1[int0] = 1.0;
        }

        for (int int1 = Math.min(list.size(), double2.length) - 1; int1 >= 0; int1--) {
            if (boolean0 || boolean1[int1]) {
                CircleLineIntersect.ForceCircle forceCircle0 = (CircleLineIntersect.ForceCircle)list.get(int1);

                for (int int2 = arrayList0.size() - 1; int2 >= 0; int2--) {
                    CircleLineIntersect.StaticLine staticLine = (CircleLineIntersect.StaticLine)arrayList0.get(int2);
                    CircleLineIntersect.Point point0 = CircleLineIntersect.VectorMath.closestpointonline(
                        staticLine.getX1(), staticLine.getY1(), staticLine.getX2(), staticLine.getY2(), forceCircle0.getX(), forceCircle0.getY()
                    );
                    double double3 = CircleLineIntersect.Point.distanceSq(point0.getX(), point0.getY(), forceCircle0.getX(), forceCircle0.getY());
                    if (double3 < forceCircle0.getRadiusSq()) {
                        double double4 = 0.0;
                        double double5 = 0.0;
                        if (double3 == 0.0) {
                            CircleLineIntersect.Point point1 = CircleLineIntersect.Point.midpoint(staticLine.getP1(), staticLine.getP2());
                            double double6 = staticLine.getP1().distance(staticLine.getP2());
                            double double7 = forceCircle0.distanceSq(point1);
                            if (double7 < Math.pow(forceCircle0.getRadius() + double6 / 2.0, 2.0)) {
                                if (double7 != 0.0) {
                                    double double8 = forceCircle0.distance(point1);
                                    double double9 = (forceCircle0.getX() - point1.getX()) / double8;
                                    double double10 = (forceCircle0.getY() - point1.getY()) / double8;
                                    double4 = point1.getX() + (forceCircle0.getRadius() + double6 / 2.0) * double9;
                                    double5 = point1.getY() + (forceCircle0.getRadius() + double6 / 2.0) * double10;
                                } else {
                                    double4 = forceCircle0.getX();
                                    double5 = forceCircle0.getY();
                                }

                                if (double0[int1] == -1.0) {
                                    pointVector[int1] = new CircleLineIntersect.PointVector(double4, double5);
                                } else {
                                    pointVector[int1].setPoint(double4, double5);
                                }

                                if (double0[int1] == 0.0) {
                                    collideclassindex[int1].addCollided(staticLine, int2, forceCircle0.getVector());
                                } else {
                                    collideclassindex[int1].setCollided(staticLine, int2, forceCircle0.getVector());
                                }

                                double0[int1] = 0.0;
                                continue;
                            }

                            if (double7 == Math.pow(forceCircle0.getRadius() + double6 / 2.0, 2.0) && forceCircle0.getLength() == 0.0) {
                                continue;
                            }
                        } else {
                            if (Math.min(staticLine.getX1(), staticLine.getX2()) <= point0.getX()
                                && point0.getX() <= Math.max(staticLine.getX1(), staticLine.getX2())
                                && Math.min(staticLine.getY1(), staticLine.getY2()) <= point0.getY()
                                && point0.getY() <= Math.max(staticLine.getY1(), staticLine.getY2())) {
                                double double11 = Math.sqrt(double3);
                                double double12 = (forceCircle0.getX() - point0.getX()) / double11;
                                double double13 = (forceCircle0.getY() - point0.getY()) / double11;
                                double4 = point0.getX() + forceCircle0.getRadius() * double12;
                                double5 = point0.getY() + forceCircle0.getRadius() * double13;
                                if (double0[int1] == -1.0) {
                                    pointVector[int1] = new CircleLineIntersect.PointVector(double4, double5);
                                } else {
                                    pointVector[int1].setPoint(double4, double5);
                                }

                                if (double0[int1] == 0.0) {
                                    collideclassindex[int1].addCollided(staticLine, int2, forceCircle0.getVector());
                                } else {
                                    collideclassindex[int1].setCollided(staticLine, int2, forceCircle0.getVector());
                                }

                                double0[int1] = 0.0;
                                continue;
                            }

                            if (CircleLineIntersect.Point.distanceSq(forceCircle0.getX(), forceCircle0.getY(), staticLine.getX1(), staticLine.getY1())
                                < forceCircle0.getRadiusSq()) {
                                double double14 = CircleLineIntersect.Point.distance(
                                    forceCircle0.getX(), forceCircle0.getY(), staticLine.getX1(), staticLine.getY1()
                                );
                                double double15 = (forceCircle0.getX() - staticLine.getX1()) / double14;
                                double double16 = (forceCircle0.getY() - staticLine.getY1()) / double14;
                                double4 = staticLine.getX1() + forceCircle0.getRadius() * double15;
                                double5 = staticLine.getY1() + forceCircle0.getRadius() * double16;
                                if (double0[int1] == -1.0) {
                                    pointVector[int1] = new CircleLineIntersect.PointVector(double4, double5);
                                } else {
                                    pointVector[int1].setPoint(double4, double5);
                                }

                                if (double0[int1] == 0.0) {
                                    collideclassindex[int1].addCollided(staticLine, int2, forceCircle0.getVector());
                                } else {
                                    collideclassindex[int1].setCollided(staticLine, int2, forceCircle0.getVector());
                                }

                                double0[int1] = 0.0;
                                continue;
                            }

                            if (CircleLineIntersect.Point.distanceSq(forceCircle0.getX(), forceCircle0.getY(), staticLine.getX2(), staticLine.getY2())
                                < forceCircle0.getRadiusSq()) {
                                double double17 = CircleLineIntersect.Point.distance(
                                    forceCircle0.getX(), forceCircle0.getY(), staticLine.getX2(), staticLine.getY2()
                                );
                                double double18 = (forceCircle0.getX() - staticLine.getX2()) / double17;
                                double double19 = (forceCircle0.getY() - staticLine.getY2()) / double17;
                                double4 = staticLine.getX2() + forceCircle0.getRadius() * double18;
                                double5 = staticLine.getY2() + forceCircle0.getRadius() * double19;
                                if (double0[int1] == -1.0) {
                                    pointVector[int1] = new CircleLineIntersect.PointVector(double4, double5);
                                } else {
                                    pointVector[int1].setPoint(double4, double5);
                                }

                                if (double0[int1] == 0.0) {
                                    collideclassindex[int1].addCollided(staticLine, int2, forceCircle0.getVector());
                                } else {
                                    collideclassindex[int1].setCollided(staticLine, int2, forceCircle0.getVector());
                                }

                                double0[int1] = 0.0;
                                continue;
                            }
                        }
                    }

                    double double20 = staticLine.getY2() - staticLine.getY1();
                    double double21 = staticLine.getX1() - staticLine.getX2();
                    double double22 = (staticLine.getY2() - staticLine.getY1()) * staticLine.getX1()
                        + (staticLine.getX1() - staticLine.getX2()) * staticLine.getY1();
                    double double23 = forceCircle0.getvy();
                    double double24 = -forceCircle0.getvx();
                    double double25 = forceCircle0.getvy() * forceCircle0.getX() + -forceCircle0.getvx() * forceCircle0.getY();
                    double double26 = double20 * double24 - double23 * double21;
                    double double27 = 0.0;
                    double double28 = 0.0;
                    if (double26 != 0.0) {
                        double27 = (double24 * double22 - double21 * double25) / double26;
                        double28 = (double20 * double25 - double23 * double22) / double26;
                    }

                    CircleLineIntersect.Point point2 = CircleLineIntersect.VectorMath.closestpointonline(
                        staticLine.getX1(), staticLine.getY1(), staticLine.getX2(), staticLine.getY2(), forceCircle0.getX2(), forceCircle0.getY2()
                    );
                    CircleLineIntersect.Point point3 = CircleLineIntersect.VectorMath.closestpointonline(
                        forceCircle0.getX(), forceCircle0.getY(), forceCircle0.getX2(), forceCircle0.getY2(), staticLine.getX1(), staticLine.getY1()
                    );
                    CircleLineIntersect.Point point4 = CircleLineIntersect.VectorMath.closestpointonline(
                        forceCircle0.getX(), forceCircle0.getY(), forceCircle0.getX2(), forceCircle0.getY2(), staticLine.getX2(), staticLine.getY2()
                    );
                    if (CircleLineIntersect.Point.distanceSq(point2.getX(), point2.getY(), forceCircle0.getX2(), forceCircle0.getY2())
                                < forceCircle0.getRadiusSq()
                            && Math.min(staticLine.getX1(), staticLine.getX2()) <= point2.getX()
                            && point2.getX() <= Math.max(staticLine.getX1(), staticLine.getX2())
                            && Math.min(staticLine.getY1(), staticLine.getY2()) <= point2.getY()
                            && point2.getY() <= Math.max(staticLine.getY1(), staticLine.getY2())
                        || CircleLineIntersect.Point.distanceSq(point3.getX(), point3.getY(), staticLine.getX1(), staticLine.getY1())
                                < forceCircle0.getRadiusSq()
                            && Math.min(forceCircle0.getX(), forceCircle0.getX() + forceCircle0.getvx()) <= point3.getX()
                            && point3.getX() <= Math.max(forceCircle0.getX(), forceCircle0.getX() + forceCircle0.getvx())
                            && Math.min(forceCircle0.getY(), forceCircle0.getY() + forceCircle0.getvy()) <= point3.getY()
                            && point3.getY() <= Math.max(forceCircle0.getY(), forceCircle0.getY() + forceCircle0.getvy())
                        || CircleLineIntersect.Point.distanceSq(point4.getX(), point4.getY(), staticLine.getX2(), staticLine.getY2())
                                < forceCircle0.getRadiusSq()
                            && Math.min(forceCircle0.getX(), forceCircle0.getX() + forceCircle0.getvx()) <= point4.getX()
                            && point4.getX() <= Math.max(forceCircle0.getX(), forceCircle0.getX() + forceCircle0.getvx())
                            && Math.min(forceCircle0.getY(), forceCircle0.getY() + forceCircle0.getvy()) <= point4.getY()
                            && point4.getY() <= Math.max(forceCircle0.getY(), forceCircle0.getY() + forceCircle0.getvy())
                        || Math.min(forceCircle0.getX(), forceCircle0.getX() + forceCircle0.getvx()) <= double27
                            && double27 <= Math.max(forceCircle0.getX(), forceCircle0.getX() + forceCircle0.getvx())
                            && Math.min(forceCircle0.getY(), forceCircle0.getY() + forceCircle0.getvy()) <= double28
                            && double28 <= Math.max(forceCircle0.getY(), forceCircle0.getY() + forceCircle0.getvy())
                            && Math.min(staticLine.getX1(), staticLine.getX2()) <= double27
                            && double27 <= Math.max(staticLine.getX1(), staticLine.getX2())
                            && Math.min(staticLine.getY1(), staticLine.getY2()) <= double28
                            && double28 <= Math.max(staticLine.getY1(), staticLine.getY2())
                        || CircleLineIntersect.Point.distanceSq(staticLine.getX1(), staticLine.getY1(), forceCircle0.getX2(), forceCircle0.getY2())
                            <= forceCircle0.getRadiusSq()
                        || CircleLineIntersect.Point.distanceSq(staticLine.getX2(), staticLine.getY2(), forceCircle0.getX2(), forceCircle0.getY2())
                            <= forceCircle0.getRadiusSq()) {
                        double double29 = -double21;
                        double double30 = double29 * forceCircle0.getX() + double20 * forceCircle0.getY();
                        double double31 = double20 * double20 - double29 * double21;
                        double double32 = 0.0;
                        double double33 = 0.0;
                        if (double31 != 0.0) {
                            double32 = (double20 * double22 - double21 * double30) / double31;
                            double33 = (double20 * double30 - double29 * double22) / double31;
                            double double34 = CircleLineIntersect.Point.distance(double27, double28, forceCircle0.getX(), forceCircle0.getY())
                                * forceCircle0.getRadius()
                                / CircleLineIntersect.Point.distance(double32, double33, forceCircle0.getX(), forceCircle0.getY());
                            double27 += -double34 * forceCircle0.getnormvx();
                            double28 += -double34 * forceCircle0.getnormvy();
                            double double35 = double29 * double27 + double20 * double28;
                            double double36 = (double20 * double22 - double21 * double35) / double31;
                            double double37 = (double20 * double35 - double29 * double22) / double31;
                            if (Math.min(staticLine.getX1(), staticLine.getX2()) <= double36
                                && double36 <= Math.max(staticLine.getX1(), staticLine.getX2())
                                && Math.min(staticLine.getY1(), staticLine.getY2()) <= double37
                                && double37 <= Math.max(staticLine.getY1(), staticLine.getY2())) {
                                double32 += double27 - double36;
                                double33 += double28 - double37;
                                double double38 = Math.pow(double27 - forceCircle0.getX(), 2.0) + Math.pow(double28 - forceCircle0.getY(), 2.0);
                                if (double38 <= double0[int1] || double0[int1] < 0.0) {
                                    CircleLineIntersect.RectVector rectVector0 = null;
                                    if (!collideclassindex[int1].collided() || double0[int1] != double38) {
                                        for (int int3 = 0; int3 < collideclassindex[int1].size(); int3++) {
                                            if (collideclassindex[int1].collided()
                                                && ((CircleLineIntersect.Collider)collideclassindex[int1].getColliders().get(int3)).getCollideobj() instanceof CircleLineIntersect.ForceCircle
                                                && double0[int1] > double38) {
                                                pointVector[((CircleLineIntersect.Collider)collideclassindex[int1].getColliders().get(int3)).getCollidewith()] = new CircleLineIntersect.PointVector(
                                                    (CircleLineIntersect.PointVector)list.get(
                                                        ((CircleLineIntersect.Collider)collideclassindex[int1].getColliders().get(int3)).getCollidewith()
                                                    )
                                                );
                                                double0[((CircleLineIntersect.Collider)collideclassindex[int1].getColliders().get(int3)).getCollidewith()] = -1.0;
                                            }
                                        }
                                    }

                                    if (CircleLineIntersect.Point.distanceSq(double32, double33, forceCircle0.getX(), forceCircle0.getY()) < 1.0E-8) {
                                        CircleLineIntersect.Point point5 = CircleLineIntersect.VectorMath.closestpointonline(
                                            staticLine.getX1() + (double27 - double32),
                                            staticLine.getY1() + (double28 - double33),
                                            staticLine.getX2() + (double27 - double32),
                                            staticLine.getY2() + (double28 - double33),
                                            forceCircle0.getX2(),
                                            forceCircle0.getY2()
                                        );
                                        rectVector0 = new CircleLineIntersect.RectVector(
                                            point5.getX() + (point5.getX() - forceCircle0.getX2()) - forceCircle0.getX(),
                                            point5.getY() + (point5.getY() - forceCircle0.getY2()) - forceCircle0.getY()
                                        );
                                        rectVector0 = (CircleLineIntersect.RectVector)rectVector0.getUnitVector();
                                        rectVector0 = new CircleLineIntersect.RectVector(
                                            rectVector0.getvx() * forceCircle0.getLength(), rectVector0.getvy() * forceCircle0.getLength()
                                        );
                                    } else {
                                        rectVector0 = new CircleLineIntersect.RectVector(
                                            forceCircle0.getX() - 2.0 * (double32 - double27) - double27,
                                            forceCircle0.getY() - 2.0 * (double33 - double28) - double28
                                        );
                                        rectVector0 = (CircleLineIntersect.RectVector)rectVector0.getUnitVector();
                                        rectVector0 = new CircleLineIntersect.RectVector(
                                            rectVector0.getvx() * forceCircle0.getLength(), rectVector0.getvy() * forceCircle0.getLength()
                                        );
                                    }

                                    rectVector0 = (CircleLineIntersect.RectVector)rectVector0.getUnitVector();
                                    rectVector0 = new CircleLineIntersect.RectVector(
                                        rectVector0.getvx() * forceCircle0.getLength(), rectVector0.getvy() * forceCircle0.getLength()
                                    );
                                    if (double0[int1] == -1.0) {
                                        pointVector[int1] = new CircleLineIntersect.PointVector(double27, double28);
                                    } else {
                                        pointVector[int1].setPoint(double27, double28);
                                    }

                                    if (double0[int1] == double38) {
                                        collideclassindex[int1].addCollided(staticLine, int2, rectVector0);
                                    } else {
                                        collideclassindex[int1].setCollided(staticLine, int2, rectVector0);
                                    }

                                    double0[int1] = double38;
                                }
                            } else {
                                double double39 = forceCircle0.getRadius() * forceCircle0.getRadius();
                                CircleLineIntersect.Point point6 = CircleLineIntersect.VectorMath.closestpointonline(
                                    forceCircle0.getX(),
                                    forceCircle0.getY(),
                                    forceCircle0.getX2(),
                                    forceCircle0.getY2(),
                                    staticLine.getX1(),
                                    staticLine.getY1()
                                );
                                double double40 = CircleLineIntersect.Point.distanceSq(point6.getX(), point6.getY(), staticLine.getX1(), staticLine.getY1());
                                double double41 = CircleLineIntersect.Point.distanceSq(point6.getX(), point6.getY(), forceCircle0.getX(), forceCircle0.getY());
                                CircleLineIntersect.Point point7 = CircleLineIntersect.VectorMath.closestpointonline(
                                    forceCircle0.getX(),
                                    forceCircle0.getY(),
                                    forceCircle0.getX2(),
                                    forceCircle0.getY2(),
                                    staticLine.getX2(),
                                    staticLine.getY2()
                                );
                                double double42 = CircleLineIntersect.Point.distanceSq(point7.getX(), point7.getY(), staticLine.getX2(), staticLine.getY2());
                                double double43 = CircleLineIntersect.Point.distanceSq(point7.getX(), point7.getY(), forceCircle0.getX(), forceCircle0.getY());
                                double double44 = 0.0;
                                if (double41 < double43 && double40 <= double42) {
                                    double44 = Math.sqrt(Math.abs(double39 - double40));
                                    double27 = point6.getX() - double44 * forceCircle0.getnormvx();
                                    double28 = point6.getY() - double44 * forceCircle0.getnormvy();
                                    double32 = staticLine.getX1();
                                    double33 = staticLine.getY1();
                                } else if (double41 > double43 && double40 >= double42) {
                                    double44 = Math.sqrt(Math.abs(double39 - double42));
                                    double27 = point7.getX() - double44 * forceCircle0.getnormvx();
                                    double28 = point7.getY() - double44 * forceCircle0.getnormvy();
                                    double32 = staticLine.getX2();
                                    double33 = staticLine.getY2();
                                } else if (double40 < double42) {
                                    if (!(double41 < double43)
                                        && !(CircleLineIntersect.Point.distanceSq(double36, double37, staticLine.getX1(), staticLine.getY1()) <= double39)) {
                                        double44 = Math.sqrt(Math.abs(double39 - double42));
                                        double27 = point7.getX() - double44 * forceCircle0.getnormvx();
                                        double28 = point7.getY() - double44 * forceCircle0.getnormvy();
                                        double32 = staticLine.getX2();
                                        double33 = staticLine.getY2();
                                    } else {
                                        double44 = Math.sqrt(Math.abs(double39 - double40));
                                        double27 = point6.getX() - double44 * forceCircle0.getnormvx();
                                        double28 = point6.getY() - double44 * forceCircle0.getnormvy();
                                        double32 = staticLine.getX1();
                                        double33 = staticLine.getY1();
                                    }
                                } else if (double40 > double42) {
                                    if (!(double43 < double41)
                                        && !(CircleLineIntersect.Point.distanceSq(double36, double37, staticLine.getX2(), staticLine.getY2()) <= double39)) {
                                        double44 = Math.sqrt(Math.abs(double39 - double40));
                                        double27 = point6.getX() - double44 * forceCircle0.getnormvx();
                                        double28 = point6.getY() - double44 * forceCircle0.getnormvy();
                                        double32 = staticLine.getX1();
                                        double33 = staticLine.getY1();
                                    } else {
                                        double44 = Math.sqrt(Math.abs(double39 - double42));
                                        double27 = point7.getX() - double44 * forceCircle0.getnormvx();
                                        double28 = point7.getY() - double44 * forceCircle0.getnormvy();
                                        double32 = staticLine.getX2();
                                        double33 = staticLine.getY2();
                                    }
                                } else if ((
                                        !(Math.min(forceCircle0.getX(), forceCircle0.getX2()) <= point7.getX())
                                            || !(point7.getX() <= Math.max(forceCircle0.getX(), forceCircle0.getX2()))
                                            || !(Math.min(forceCircle0.getY(), forceCircle0.getY2()) <= point7.getY())
                                            || !(point7.getY() <= Math.max(forceCircle0.getY(), forceCircle0.getY2()))
                                    )
                                    && !(
                                        CircleLineIntersect.Point.distanceSq(point7.getX(), point7.getY(), forceCircle0.getX2(), forceCircle0.getY2())
                                            <= forceCircle0.getRadiusSq()
                                    )) {
                                    double44 = Math.sqrt(Math.abs(double39 - double40));
                                    double27 = point6.getX() - double44 * forceCircle0.getnormvx();
                                    double28 = point6.getY() - double44 * forceCircle0.getnormvy();
                                    double32 = staticLine.getX1();
                                    double33 = staticLine.getY1();
                                } else if ((
                                        !(Math.min(forceCircle0.getX(), forceCircle0.getX2()) <= point6.getX())
                                            || !(point6.getX() <= Math.max(forceCircle0.getX(), forceCircle0.getX2()))
                                            || !(Math.min(forceCircle0.getY(), forceCircle0.getY2()) <= point6.getY())
                                            || !(point6.getY() <= Math.max(forceCircle0.getY(), forceCircle0.getY2()))
                                    )
                                    && !(
                                        CircleLineIntersect.Point.distanceSq(point7.getX(), point7.getY(), forceCircle0.getX2(), forceCircle0.getY2())
                                            <= forceCircle0.getRadiusSq()
                                    )) {
                                    double44 = Math.sqrt(Math.abs(double39 - double42));
                                    double27 = point7.getX() - double44 * forceCircle0.getnormvx();
                                    double28 = point7.getY() - double44 * forceCircle0.getnormvy();
                                    double32 = staticLine.getX2();
                                    double33 = staticLine.getY2();
                                } else if (double41 < double43) {
                                    double44 = Math.sqrt(Math.abs(double39 - double40));
                                    double27 = point6.getX() - double44 * forceCircle0.getnormvx();
                                    double28 = point6.getY() - double44 * forceCircle0.getnormvy();
                                    double32 = staticLine.getX1();
                                    double33 = staticLine.getY1();
                                } else {
                                    double44 = Math.sqrt(Math.abs(double39 - double42));
                                    double27 = point7.getX() - double44 * forceCircle0.getnormvx();
                                    double28 = point7.getY() - double44 * forceCircle0.getnormvy();
                                    double32 = staticLine.getX2();
                                    double33 = staticLine.getY2();
                                }

                                double double45 = Math.pow(double27 - forceCircle0.getX(), 2.0) + Math.pow(double28 - forceCircle0.getY(), 2.0);
                                if (double45 <= double0[int1] || double0[int1] < 0.0) {
                                    CircleLineIntersect.RectVector rectVector1 = null;
                                    if (!collideclassindex[int1].collided() || double0[int1] != double45) {
                                        for (int int4 = 0; int4 < collideclassindex[int1].size(); int4++) {
                                            if (collideclassindex[int1].collided()
                                                && ((CircleLineIntersect.Collider)collideclassindex[int1].getColliders().get(int4)).getCollideobj() instanceof CircleLineIntersect.ForceCircle
                                                && double0[int1] > double45) {
                                                pointVector[((CircleLineIntersect.Collider)collideclassindex[int1].getColliders().get(int4)).getCollidewith()] = new CircleLineIntersect.PointVector(
                                                    (CircleLineIntersect.PointVector)list.get(
                                                        ((CircleLineIntersect.Collider)collideclassindex[int1].getColliders().get(int4)).getCollidewith()
                                                    )
                                                );
                                                double0[((CircleLineIntersect.Collider)collideclassindex[int1].getColliders().get(int4)).getCollidewith()] = -1.0;
                                            }
                                        }
                                    }

                                    rectVector1 = new CircleLineIntersect.RectVector(
                                        double27 - (double32 - double27) - double27, double28 - (double33 - double28) - double28
                                    );
                                    rectVector1 = (CircleLineIntersect.RectVector)rectVector1.getUnitVector();
                                    rectVector1 = new CircleLineIntersect.RectVector(
                                        rectVector1.getvx() * forceCircle0.getLength(), rectVector1.getvy() * forceCircle0.getLength()
                                    );
                                    if (double0[int1] == -1.0) {
                                        pointVector[int1] = new CircleLineIntersect.PointVector(double27, double28);
                                    } else {
                                        pointVector[int1].setPoint(double27, double28);
                                    }

                                    if (double0[int1] == double45) {
                                        collideclassindex[int1].addCollided(staticLine, int2, rectVector1);
                                    } else {
                                        collideclassindex[int1].setCollided(staticLine, int2, rectVector1);
                                    }

                                    double0[int1] = double45;
                                }
                            }
                        }
                    }
                }
            }
        }

        ArrayList arrayList1 = new ArrayList((int)Math.ceil((double)(list.size() / 10)));

        for (int int5 = 0; int5 < pointVector.length; int5++) {
            if (collideclassindex[int5].collided()) {
                CircleLineIntersect.ForceCircle forceCircle1 = (CircleLineIntersect.ForceCircle)list.get(int5);
                if (forceCircle1.isFrozen()) {
                    pointVector[int5].setRect(0.0, 0.0);
                } else {
                    double double46 = 0.0;
                    double double47 = 0.0;
                    boolean boolean2 = false;
                    double double48 = 0.0;

                    for (int int6 = 0; int6 < collideclassindex[int5].size(); int6++) {
                        Object object = ((CircleLineIntersect.Collider)collideclassindex[int5].getColliders().get(int6)).getCollideobj();
                        double48 += ((CircleLineIntersect.ForceCircle)list.get(int5))
                            .getRestitution(((CircleLineIntersect.Collider)collideclassindex[int5].getColliders().get(int6)).getCollideobj());
                        if (object instanceof CircleLineIntersect.StaticLine
                            && ((CircleLineIntersect.Collider)collideclassindex[int5].getColliders().get(int6)).getCollideforce() != null) {
                            double46 += ((CircleLineIntersect.Collider)collideclassindex[int5].getColliders().get(int6)).getCollideforce().getvx();
                            double47 += ((CircleLineIntersect.Collider)collideclassindex[int5].getColliders().get(int6)).getCollideforce().getvy();
                        }
                    }

                    double48 /= (double)collideclassindex[int5].getColliders().size();
                    if (double0[int5] == -1.0) {
                        pointVector[int5] = new CircleLineIntersect.PointVector(pointVector[int5].getX(), pointVector[int5].getY());
                    }

                    pointVector[int5].setRect(double46 * double48, double47 * double48);
                    arrayList1.add(int5);
                    if (double1[int5] == 1.0 && ((CircleLineIntersect.ForceCircle)list.get(int5)).getLength() != 0.0 && !boolean2) {
                        if (double0[int5] == 0.0) {
                            double1[int5] = 0.0;
                        } else if (double0[int5] > 0.0) {
                            double1[int5] = Math.sqrt(double0[int5]) / ((CircleLineIntersect.ForceCircle)list.get(int5)).getLength();
                        } else {
                            double1[int5] = ((CircleLineIntersect.ForceCircle)list.get(int5)).distance(pointVector[int5])
                                / ((CircleLineIntersect.ForceCircle)list.get(int5)).getLength();
                        }
                    }

                    double2[int5] += double1[int5] * (1.0 - double2[int5]);
                    if (!pointVector[int5].equals(list.get(int5))) {
                        boolean1[int5] = true;
                    }
                }
            }
        }

        return new CircleLineIntersect.Collideresult(pointVector, collideclassindex, arrayList1, double2, double1, boolean1);
    }

    public static CircleLineIntersect.Collideresult checkforcecirclescollide(
        List<CircleLineIntersect.ForceCircle> list, ArrayList<CircleLineIntersect.StaticLine> arrayList, double[] _double, boolean[] boolean0, boolean boolean1
    ) {
        CircleLineIntersect.Collideresult collideresult = checkforcecirclescollidetime(list, arrayList, _double, boolean0, boolean1);
        new ArrayList();

        for (int _int = collideresult.resultants.length - 1; _int >= 0; _int--) {
            if (collideresult.collideinto[_int].collided()) {
                ((CircleLineIntersect.ForceCircle)list.get(_int)).setPointVector(collideresult.resultants[_int]);
            }
        }

        return collideresult;
    }

    public static CircleLineIntersect.Collideresult checkforcecirclescollide(
        List<CircleLineIntersect.ForceCircle> list, ArrayList<CircleLineIntersect.StaticLine> arrayList
    ) {
        double[] _double = new double[list.size()];
        boolean[] _boolean = new boolean[list.size()];

        for (int _int = list.size() - 1; _int >= 0; _int--) {
            _double[_int] = 1.0;
        }

        return checkforcecirclescollide(list, arrayList, _double, _boolean, true);
    }

    public static boolean TEST(Vector3f vector3f1, float float3, float float5, float float1, float float0, CarController carController) {
        Vector3f vector3f0 = new Vector3f();
        vector3f1.cross(new Vector3f(0.0F, 1.0F, 0.0F), vector3f0);
        vector3f1.x *= float0;
        vector3f1.z *= float0;
        vector3f0.x *= float1;
        vector3f0.z *= float1;
        float float2 = float3 + vector3f1.x;
        float float4 = float5 + vector3f1.z;
        float float6 = float3 - vector3f1.x;
        float float7 = float5 - vector3f1.z;
        float float8 = float2 - vector3f0.x / 2.0F;
        float float9 = float2 + vector3f0.x / 2.0F;
        float float10 = float6 - vector3f0.x / 2.0F;
        float float11 = float6 + vector3f0.x / 2.0F;
        float float12 = float7 - vector3f0.z / 2.0F;
        float float13 = float7 + vector3f0.z / 2.0F;
        float float14 = float4 - vector3f0.z / 2.0F;
        float float15 = float4 + vector3f0.z / 2.0F;
        float8 += WorldSimulation.instance.offsetX;
        float14 += WorldSimulation.instance.offsetY;
        float9 += WorldSimulation.instance.offsetX;
        float15 += WorldSimulation.instance.offsetY;
        float10 += WorldSimulation.instance.offsetX;
        float12 += WorldSimulation.instance.offsetY;
        float11 += WorldSimulation.instance.offsetX;
        float13 += WorldSimulation.instance.offsetY;
        ArrayList arrayList0 = new ArrayList();
        CircleLineIntersect.StaticLine staticLine0;
        arrayList0.add(staticLine0 = new CircleLineIntersect.StaticLine((double)float8, (double)float14, (double)float9, (double)float15));
        CircleLineIntersect.StaticLine staticLine1;
        arrayList0.add(staticLine1 = new CircleLineIntersect.StaticLine((double)float9, (double)float15, (double)float11, (double)float13));
        CircleLineIntersect.StaticLine staticLine2;
        arrayList0.add(staticLine2 = new CircleLineIntersect.StaticLine((double)float11, (double)float13, (double)float10, (double)float12));
        CircleLineIntersect.StaticLine staticLine3;
        arrayList0.add(staticLine3 = new CircleLineIntersect.StaticLine((double)float10, (double)float12, (double)float8, (double)float14));
        IsoPlayer isoPlayer = IsoPlayer.getInstance();
        ArrayList arrayList1 = new ArrayList();
        byte _byte = 8;
        CircleLineIntersect.ForceCircle forceCircle = new CircleLineIntersect.ForceCircle(
            (double)isoPlayer.x, (double)isoPlayer.y, (double)(isoPlayer.nx - isoPlayer.x), (double)(isoPlayer.ny - isoPlayer.y), 0.295
        );
        if (carController != null) {
            carController.drawCircle((float)forceCircle.getX2(), (float)forceCircle.getY2(), 0.3F);
        }

        arrayList1.add(forceCircle);
        CircleLineIntersect.Collideresult collideresult = checkforcecirclescollide(arrayList1, arrayList0);
        if (carController != null) {
            carController.drawCircle((float)forceCircle.getX(), (float)forceCircle.getY(), (float)forceCircle.getRadius());
        }

        if (collideresult.collidelist.isEmpty()) {
            return false;
        } else {
            int int0 = collideresult.collideinto.length;
            Vector2f vector2f = new Vector2f(isoPlayer.nx - isoPlayer.x, isoPlayer.ny - isoPlayer.y);
            if (vector2f.length() > 0.0F) {
                vector2f.normalise();
            }

            for (int int1 = 0; int1 < collideresult.collideinto.length; int1++) {
                CircleLineIntersect.StaticLine staticLine4 = (CircleLineIntersect.StaticLine)((CircleLineIntersect.Collider)collideresult.collideinto[int1]
                        .getColliders()
                        .get(0))
                    .getCollideobj();
                if (staticLine4 == staticLine3 || staticLine4 == staticLine1) {
                    LineDrawer.addLine(
                        float2 + WorldSimulation.instance.offsetX,
                        float4 + WorldSimulation.instance.offsetY,
                        0.0F,
                        float6 + WorldSimulation.instance.offsetX,
                        float7 + WorldSimulation.instance.offsetY,
                        0.0F,
                        1.0F,
                        1.0F,
                        1.0F,
                        null,
                        true
                    );
                    CircleLineIntersect.Point point0 = CircleLineIntersect.VectorMath.closestpointonline(
                        (double)(float2 + WorldSimulation.instance.offsetX),
                        (double)(float4 + WorldSimulation.instance.offsetY),
                        (double)(float6 + WorldSimulation.instance.offsetX),
                        (double)(float7 + WorldSimulation.instance.offsetY),
                        forceCircle.getX(),
                        forceCircle.getY()
                    );
                    vector3f1.set((float)(point0.x - (double)isoPlayer.x), (float)(point0.y - (double)isoPlayer.y), 0.0F);
                    vector3f1.normalize();
                    double double0 = CircleLineIntersect.VectorMath.dotproduct((double)vector2f.x, (double)vector2f.y, (double)vector3f1.x, (double)vector3f1.y);
                    if (double0 < 0.0) {
                        int0--;
                    }
                }

                if (staticLine4 == staticLine0 || staticLine4 == staticLine2) {
                    LineDrawer.addLine(
                        float3 - vector3f0.x / 2.0F + WorldSimulation.instance.offsetX,
                        float5 - vector3f0.z / 2.0F + WorldSimulation.instance.offsetY,
                        0.0F,
                        float3 + vector3f0.x / 2.0F + WorldSimulation.instance.offsetX,
                        float5 + vector3f0.z / 2.0F + WorldSimulation.instance.offsetY,
                        0.0F,
                        1.0F,
                        1.0F,
                        1.0F,
                        null,
                        true
                    );
                    CircleLineIntersect.Point point1 = CircleLineIntersect.VectorMath.closestpointonline(
                        (double)(float3 - vector3f0.x / 2.0F + WorldSimulation.instance.offsetX),
                        (double)(float5 - vector3f0.z / 2.0F + WorldSimulation.instance.offsetY),
                        (double)(float3 + vector3f0.x / 2.0F + WorldSimulation.instance.offsetX),
                        (double)(float5 + vector3f0.z / 2.0F + WorldSimulation.instance.offsetY),
                        forceCircle.getX(),
                        forceCircle.getY()
                    );
                    vector3f1.set((float)(point1.x - (double)isoPlayer.x), (float)(point1.y - (double)isoPlayer.y), 0.0F);
                    vector3f1.normalize();
                    double double1 = CircleLineIntersect.VectorMath.dotproduct((double)vector2f.x, (double)vector2f.y, (double)vector3f1.x, (double)vector3f1.y);
                    if (double1 < 0.0) {
                        int0--;
                    }
                }
            }

            if (int0 == 0) {
                return false;
            } else {
                vector3f1.set((float)forceCircle.getX(), (float)forceCircle.getY(), 0.0F);
                return true;
            }
        }
    }

    static class Collideclassindex {
        private ArrayList<CircleLineIntersect.Collider> colliders = new ArrayList(1);
        private int numforcecircles;

        public Collideclassindex() {
            this.numforcecircles = 0;
        }

        public Collideclassindex(Object object, int _int, CircleLineIntersect.Vector vector) {
            this.colliders.add(new CircleLineIntersect.Collider(object, _int, vector));
        }

        public boolean collided() {
            return this.size() > 0;
        }

        public void reset() {
            this.colliders.trimToSize();
            this.colliders.clear();
            this.numforcecircles = 0;
        }

        public void setCollided(Object object, int _int, CircleLineIntersect.Vector vector) {
            if (this.size() > 0) {
                this.reset();
            }

            if (object instanceof CircleLineIntersect.ForceCircle && !((CircleLineIntersect.ForceCircle)object).isFrozen()) {
                this.numforcecircles++;
            }

            this.colliders.add(new CircleLineIntersect.Collider(object, _int, vector));
        }

        public void addCollided(Object object, int _int, CircleLineIntersect.Vector vector) {
            if (object instanceof CircleLineIntersect.ForceCircle && !((CircleLineIntersect.ForceCircle)object).isFrozen()) {
                this.numforcecircles++;
            }

            this.colliders.add(new CircleLineIntersect.Collider(object, _int, vector));
        }

        public ArrayList<CircleLineIntersect.Collider> getColliders() {
            return this.colliders;
        }

        public int getNumforcecircles() {
            return this.numforcecircles;
        }

        public CircleLineIntersect.Collider contains(Object object) {
            for (CircleLineIntersect.Collider collider : this.colliders) {
                if (collider.getCollideobj().equals(object)) {
                    return collider;
                }
            }

            return null;
        }

        public int size() {
            return this.colliders.size();
        }

        public String toString() {
            String string = "";

            for (CircleLineIntersect.Collider collider : this.colliders) {
                string = string + collider.toString() + "\n";
            }

            return string;
        }
    }

    static class Collider {
        private Object collideobj;
        private Integer collideindex;
        private CircleLineIntersect.Vector collideforce;

        public Collider(CircleLineIntersect.Vector vector, Integer integer) {
            this.collideobj = vector;
            this.collideindex = integer;
            this.collideforce = vector;
        }

        public Collider(Object object, Integer integer, CircleLineIntersect.Vector vector) {
            this.collideobj = object;
            this.collideindex = integer;
            this.collideforce = vector;
        }

        public Object getCollideobj() {
            return this.collideobj;
        }

        public Integer getCollidewith() {
            return this.collideindex;
        }

        public CircleLineIntersect.Vector getCollideforce() {
            return this.collideforce;
        }

        public void setCollideforce(CircleLineIntersect.Vector vector) {
            this.collideforce = vector;
        }

        public String toString() {
            return this.collideobj.getClass().getSimpleName() + " @ " + this.collideindex + " hit with " + this.collideforce.toString();
        }
    }

    static class Collideresult {
        protected CircleLineIntersect.PointVector[] resultants;
        protected ArrayList<Integer> collidelist;
        protected CircleLineIntersect.Collideclassindex[] collideinto;
        protected double[] timepassed;
        protected double[] collidetime;
        protected boolean[] modified;

        public Collideresult(
            CircleLineIntersect.PointVector[] pointVector,
            CircleLineIntersect.Collideclassindex[] collideclassindex,
            ArrayList<Integer> arrayList,
            double[] double0,
            double[] double1,
            boolean[] _boolean
        ) {
            this.resultants = pointVector;
            this.collideinto = collideclassindex;
            this.collidelist = arrayList;
            this.timepassed = double0;
            this.collidetime = double1;
            this.modified = _boolean;
        }

        public String toString() {
            return this.collidelist.toString();
        }
    }

    static class Force extends CircleLineIntersect.PointVector {
        protected double length;
        protected double mass;

        public Force(double double0, double double1, double double2, double double3) {
            super(double0, double1, double2, double3);
            this.length = CircleLineIntersect.VectorMath.length(double2, double3);
        }

        @Override
        public double getLength() {
            return this.length;
        }

        public double getnormvx() {
            return this.length > 0.0 ? this.vx / this.length : 0.0;
        }

        public double getnormvy() {
            return this.length > 0.0 ? this.vy / this.length : 0.0;
        }

        public double getRestitution(Object var1) {
            return 1.0;
        }

        public void setPointVector(CircleLineIntersect.PointVector pointVector) {
            this.x = pointVector.getX();
            this.y = pointVector.getY();
            if (!this.isFrozen() && (this.vx != pointVector.getvx() || this.vy != pointVector.getvy())) {
                this.vx = pointVector.getvx();
                this.vy = pointVector.getvy();
                this.length = CircleLineIntersect.VectorMath.length(this.vx, this.vy);
            }
        }

        boolean isFrozen() {
            return false;
        }
    }

    static class ForceCircle extends CircleLineIntersect.Force {
        protected double radius;
        protected double radiussq;

        public ForceCircle(double double0, double double1, double double2, double double3, double double4) {
            super(double0, double1, double2, double3);
            this.radius = double4;
            this.radiussq = double4 * double4;
        }

        double getRadius() {
            return this.radius;
        }

        double getRadiusSq() {
            return this.radiussq;
        }
    }

    static class Point {
        double x;
        double y;

        public static final CircleLineIntersect.Point midpoint(double double2, double double0, double double3, double double1) {
            return new CircleLineIntersect.Point((double2 + double3) / 2.0, (double0 + double1) / 2.0);
        }

        public static final CircleLineIntersect.Point midpoint(CircleLineIntersect.Point point1, CircleLineIntersect.Point point0) {
            return midpoint(point1.getX(), point1.getY(), point0.getX(), point0.getY());
        }

        public Point(double double0, double double1) {
            if (Double.isNaN(double0) || Double.isInfinite(double0)) {
                double0 = 0.0;
            }

            if (Double.isNaN(double1) || Double.isInfinite(double1)) {
                double1 = 0.0;
            }

            this.x = double0;
            this.y = double1;
        }

        public double getX() {
            return this.x;
        }

        public double getY() {
            return this.y;
        }

        public void setPoint(double double0, double double1) {
            this.x = double0;
            this.y = double1;
        }

        public static double distanceSq(double double0, double double2, double double1, double double3) {
            double0 -= double1;
            double2 -= double3;
            return double0 * double0 + double2 * double2;
        }

        public static double distance(double double0, double double2, double double1, double double3) {
            double0 -= double1;
            double2 -= double3;
            return Math.sqrt(double0 * double0 + double2 * double2);
        }

        public double distanceSq(double double0, double double1) {
            double0 -= this.getX();
            double1 -= this.getY();
            return double0 * double0 + double1 * double1;
        }

        public double distanceSq(CircleLineIntersect.Point point1) {
            double double0 = point1.getX() - this.getX();
            double double1 = point1.getY() - this.getY();
            return double0 * double0 + double1 * double1;
        }

        public double distance(CircleLineIntersect.Point point1) {
            double double0 = point1.getX() - this.getX();
            double double1 = point1.getY() - this.getY();
            return Math.sqrt(double0 * double0 + double1 * double1);
        }
    }

    static class PointVector extends CircleLineIntersect.Point implements CircleLineIntersect.Vector {
        protected double vx = 0.0;
        protected double vy = 0.0;

        public PointVector(double double0, double double1) {
            this(double0, double1, 0.0, 0.0);
        }

        public PointVector(double double0, double double1, double double2, double double3) {
            super(double0, double1);
            this.vx = double2;
            this.vy = double3;
        }

        public PointVector(CircleLineIntersect.PointVector pointVector1) {
            this(pointVector1.getX(), pointVector1.getY(), pointVector1.getvx(), pointVector1.getvy());
        }

        @Override
        public double getLength() {
            return CircleLineIntersect.VectorMath.length(this.vx, this.vy);
        }

        public CircleLineIntersect.Vector getVector() {
            return new CircleLineIntersect.RectVector(this.vx, this.vy);
        }

        @Override
        public double getvx() {
            return this.vx;
        }

        @Override
        public double getvy() {
            return this.vy;
        }

        public double getX1() {
            return this.x;
        }

        public double getX2() {
            return this.x + this.vx;
        }

        public double getY1() {
            return this.y;
        }

        public double getY2() {
            return this.y + this.vy;
        }

        public void setRect(double double0, double double1) {
            this.vx = double0;
            this.vy = double1;
        }
    }

    static class RectVector implements CircleLineIntersect.Vector {
        private double vx;
        private double vy;

        public RectVector(double double0, double double1) {
            this.vx = double0;
            this.vy = double1;
        }

        public RectVector(CircleLineIntersect.Vector vector) {
            this.setVector(vector);
        }

        @Override
        public double getLength() {
            return Math.sqrt(Math.abs(this.getvx() * this.getvx() + this.getvy() * this.getvy()));
        }

        public CircleLineIntersect.Vector getUnitVector() {
            double _double = this.getLength();
            return new CircleLineIntersect.RectVector(this.getvx() / _double, this.getvy() / _double);
        }

        @Override
        public double getvx() {
            return this.vx;
        }

        @Override
        public double getvy() {
            return this.vy;
        }

        public void setVector(CircleLineIntersect.Vector vector) {
            this.vx = vector.getvx();
            this.vy = vector.getvy();
        }
    }

    static class StaticLine extends CircleLineIntersect.Point {
        double x2;
        double y2;

        public StaticLine(double double0, double double1, double double2, double double3) {
            super(double0, double1);
            this.x2 = double2;
            this.y2 = double3;
        }

        public CircleLineIntersect.Point getP1() {
            return new CircleLineIntersect.Point(this.getX1(), this.getY1());
        }

        public CircleLineIntersect.Point getP2() {
            return new CircleLineIntersect.Point(this.getX2(), this.getY2());
        }

        public double getX1() {
            return this.x;
        }

        public double getX2() {
            return this.x2;
        }

        public double getY1() {
            return this.y;
        }

        public double getY2() {
            return this.y2;
        }
    }

    interface Vector {
        double getvx();

        double getvy();

        double getLength();
    }

    static class VectorMath {
        public static final CircleLineIntersect.Vector add(CircleLineIntersect.Vector vector1, CircleLineIntersect.Vector vector0) {
            return new CircleLineIntersect.RectVector(vector1.getvx() + vector0.getvx(), vector1.getvy() + vector0.getvy());
        }

        public static final CircleLineIntersect.Vector subtract(CircleLineIntersect.Vector vector1, CircleLineIntersect.Vector vector0) {
            return new CircleLineIntersect.RectVector(vector1.getvx() - vector0.getvx(), vector1.getvy() - vector0.getvy());
        }

        public static final double length(double double0, double double1) {
            return CircleLineIntersect.Point.distance(0.0, 0.0, double0, double1);
        }

        public static final double dotproduct(CircleLineIntersect.Vector vector1, CircleLineIntersect.Vector vector0) {
            return dotproduct(vector1.getvx(), vector1.getvy(), vector0.getvx(), vector0.getvy());
        }

        public static final double dotproduct(double double2, double double0, double double3, double double1) {
            return double2 * double3 + double0 * double1;
        }

        public static final double cosproj(CircleLineIntersect.Vector vector1, CircleLineIntersect.Vector vector0) {
            return dotproduct(vector1, vector0) / (vector1.getLength() * vector0.getLength());
        }

        public static final double cosproj(double double2, double double3, double double0, double double1) {
            return dotproduct(double2, double3, double0, double1) / (length(double2, double3) * length(double0, double1));
        }

        public static final double anglebetween(CircleLineIntersect.Vector vector0, CircleLineIntersect.Vector vector1) {
            return Math.acos(cosproj(vector0, vector1));
        }

        public static final double anglebetween(double double0, double double1, double double2, double double3) {
            return Math.acos(cosproj(double0, double1, double2, double3));
        }

        public static final double crossproduct(CircleLineIntersect.Vector vector1, CircleLineIntersect.Vector vector0) {
            return crossproduct(vector1.getvx(), vector1.getvy(), vector0.getvx(), vector0.getvy());
        }

        public static final double crossproduct(double double2, double double0, double double1, double double3) {
            return double2 * double3 - double0 * double1;
        }

        public static final double sinproj(CircleLineIntersect.Vector vector1, CircleLineIntersect.Vector vector0) {
            return crossproduct(vector1, vector0) / (vector1.getLength() * vector0.getLength());
        }

        public static final double sinproj(double double2, double double3, double double0, double double1) {
            return crossproduct(double2, double3, double0, double1) / (length(double2, double3) * length(double0, double1));
        }

        public static final boolean equaldirection(
            double double2, double double0, double double3, double double1, double double8, double double7, double double6, double double5
        ) {
            if (double2 - double3 == 0.0 && double0 - double1 == 0.0) {
                return true;
            } else {
                double double4 = ((double2 - double3) * (double2 - double8) + (double0 - double1) * (double0 - double7))
                    / (Math.abs(double6) * Math.abs(double5));
                return double4 > 0.995 && double4 <= 1.0;
            }
        }

        public static final boolean equaldirection(
            double double2, double double0, double double3, double double1, double double8, double double7, double double6, double double5, double double9
        ) {
            if (double2 - double3 == 0.0 && double0 - double1 == 0.0) {
                return true;
            } else {
                double double4 = ((double2 - double3) * (double2 - double8) + (double0 - double1) * (double0 - double7))
                    / (Math.abs(double6) * Math.abs(double5));
                return double4 > double9 && double4 <= 1.0;
            }
        }

        public static final boolean equaldirection(
            double double1, double double0, double double6, double double5, double double4, double double3, double double7
        ) {
            if (double1 == 0.0 && double0 == 0.0) {
                return true;
            } else {
                double double2 = (double1 * double6 + double0 * double5) / (Math.abs(double4) * Math.abs(double3));
                return double2 > double7 && double2 <= 1.0;
            }
        }

        public static final boolean equaldirection(double double0, double double1, double double2) {
            if (double0 > Math.PI * 2) {
                double0 -= Math.PI * 2;
            } else if (double0 < 0.0) {
                double0 += Math.PI * 2;
            }

            if (double1 > Math.PI * 2) {
                double1 -= Math.PI * 2;
            } else if (double1 < 0.0) {
                double1 += Math.PI * 2;
            }

            return Math.abs(double0 - double1) < double2;
        }

        public static final double linepointdistance(double double0, double double1, double double2, double double3, double double4, double double5) {
            CircleLineIntersect.Point point = closestpointonline(double0, double1, double2, double3, double4, double5);
            return CircleLineIntersect.Point.distance(double4, double5, point.getX(), point.getY());
        }

        public static final double linepointdistancesq(double double4, double double2, double double5, double double1, double double9, double double8) {
            double double0 = double1 - double2;
            double double3 = double4 - double5;
            double double6 = (double1 - double2) * double4 + (double4 - double5) * double2;
            double double7 = -double3 * double9 + double0 * double8;
            double double10 = double0 * double0 - -double3 * double3;
            double double11 = 0.0;
            double double12 = 0.0;
            if (double10 != 0.0) {
                double11 = (double0 * double6 - double3 * double7) / double10;
                double12 = (double0 * double7 - -double3 * double6) / double10;
            }

            return Math.abs((double11 - double9) * (double11 - double9) + (double12 - double8) * (double12 - double8));
        }

        public static final CircleLineIntersect.Point closestpointonline(CircleLineIntersect.StaticLine staticLine, CircleLineIntersect.Point point) {
            return closestpointonline(staticLine.getX(), staticLine.getY(), staticLine.getX2(), staticLine.getY2(), point.getX(), point.getY());
        }

        public static final CircleLineIntersect.Point closestpointonline(
            double double4, double double2, double double5, double double1, double double9, double double8
        ) {
            double double0 = double1 - double2;
            double double3 = double4 - double5;
            double double6 = (double1 - double2) * double4 + (double4 - double5) * double2;
            double double7 = -double3 * double9 + double0 * double8;
            double double10 = double0 * double0 - -double3 * double3;
            double double11 = 0.0;
            double double12 = 0.0;
            if (double10 != 0.0) {
                double11 = (double0 * double6 - double3 * double7) / double10;
                double12 = (double0 * double7 - -double3 * double6) / double10;
            } else {
                double11 = double9;
                double12 = double8;
            }

            return new CircleLineIntersect.Point(double11, double12);
        }

        public static final CircleLineIntersect.Vector getVector(CircleLineIntersect.Point point1, CircleLineIntersect.Point point0) {
            return new CircleLineIntersect.RectVector(point1.getX() - point0.getX(), point1.getY() - point0.getY());
        }

        public static final CircleLineIntersect.Vector rotate(CircleLineIntersect.Vector vector, double _double) {
            return new CircleLineIntersect.RectVector(
                vector.getvx() * Math.cos(_double) - vector.getvy() * Math.sin(_double),
                vector.getvx() * Math.sin(_double) + vector.getvy() * Math.cos(_double)
            );
        }
    }
}
